{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
    "<dl class=\"dl-horizontal\">\n",
    "  <dt>Title</dt> <dd> Spline Element</dd>\n",
    "  <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
    "  <dt>Backends</dt> <dd><a href='./Spline.ipynb'>Matplotlib</a></dd> <dd><a href='../bokeh/Spline.ipynb'>Bokeh</a></dd>\n",
    "</dl>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import holoviews as hv\n",
    "from holoviews import opts\n",
    "\n",
    "hv.extension('matplotlib')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The ``Spline`` annotation is used to draw cubic Bezier curves. In the overlay below, the spline is in green and the control points are shown by the light grey line:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "points = [(-0.3, -0.3), (0,0), (0.25, -0.25), (0.3, 0.3)]\n",
    "spline = hv.Spline((points, [1,4,4,4]))\n",
    "\n",
    "(spline * hv.Curve(points)).opts(\n",
    "    opts.Curve(color='#D3D3D3'),\n",
    "    opts.Spline(linewidth=6, edgecolor='green'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The first argument to ``Splines`` are the control point positions and the integers in the second list are the control codes, as documented in the [matplotlib splines documentation](http://matplotlib.org/api/path_api.html).\n",
    "\n",
    "For full documentation and the available style and plot options, use ``hv.help(hv.Spline).``"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
